package com.spring.config;

import com.spring.bean.Color;
import com.spring.bean.Person;
import com.spring.bean.Red;
import com.spring.condition.*;
import org.springframework.context.annotation.*;

/**
 * Description:
 *
 * @author lijie
 * @create 2019-01-15 0:39
 * Update by lijie 2019-01-15 0:39
 */
@Configuration
@Import({Color.class, Red.class, MyImportSelector.class, MyImportBeanDefinitionRegistrar.class})
public class MainConfig2 {
    @Bean(name="person")
    //@Scope("prototype")
    //@Lazy(true)
    public Person getPerson(){
        return new Person("李四",20);
    }
    @Conditional({WindowsCondition.class})
    @Bean(name = "bill")
    public Person getPerson01(){
        return new Person("Bill",62);
    }
    @Conditional({LinuxCondition.class})
    @Bean(name = "linus")
    public Person getPerson02(){
        return new Person("linus",42);
    }

    @Bean
    public ColorBeanFactory colorBeanFactory(){
        return new ColorBeanFactory();
    }
}
